package com.apps.member.service.impl;

import com.apps.member.model.po.KupaMemberCollectGoods;
import com.apps.member.model.po.KupaMemberLikeGoods;
import com.apps.member.dao.KupaMemberLikeGoodsMapper;
import com.apps.member.service.IKupaMemberLikeGoodsService;
import com.apps.sworld.dao.impl.sDaoImpl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 大鹏
 * @since 2020-10-13
 */
@Service
public class KupaMemberLikeGoodsServiceImpl extends sDaoImpl<KupaMemberLikeGoodsMapper, KupaMemberLikeGoods> implements IKupaMemberLikeGoodsService
{


    @Override
    public KupaMemberLikeGoods getOne(Integer member_id, Integer goods_id)
    {
        QueryWrapper<KupaMemberLikeGoods> wrapper=new QueryWrapper<>();
        wrapper.eq("member_id",member_id);
        wrapper.eq("goods_id",goods_id);
        return getOne(wrapper);
    }

    @Override
    public void saveToDB(Integer member_id, Integer goods_id) {
        KupaMemberLikeGoods likeGoods=new KupaMemberLikeGoods();
        likeGoods.setMember_id(member_id);
        likeGoods.setGoods_id(goods_id);
        saveToDB(likeGoods);
    }

    @Override
    public void delete(Integer member_id, Integer goods_id) {
        QueryWrapper<KupaMemberLikeGoods> wrapper=new QueryWrapper<>();
        wrapper.eq("member_id",member_id);
        wrapper.eq("goods_id",goods_id);
        delete(wrapper);
    }
}
